<template>
  <div>
    <div class="recommend-title">热销推荐</div>
    <ul>
      <!-- border-bottom -->
      <li class="item" v-for="item of list" :key="item.id">
        <img class="item-img" :src="item.imgUrl" />
        <div class="item-info">
          <p class="item-title">{{item.title}}</p>
          <p class="item-desc">{{item.desc}}</p>
          <button class="item-button">查看详情</button>
        </div>
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  name: 'homeRecommend',
  props: {
    list: Array
  }
}
</script>

<style scoped>
  .recommend-title {
    line-height: 32px;
    height: 32px;
    background: #eee;
    /* text-indent ? */
    /* 文本缩进 */
    text-indent: 10px;
    font-size: 14px;
  }
  .item {
    display: flex;
    overflow: hidden;
    /* 94px 等于 1.9rem */
    height: 94px;
    border-bottom: 1px solid #ccc;
    /* background: pink; */
  }
  .item-img {
    width: 1.7rem;
    height: 1.7rem;
    padding: .1rem;
  }
  .item-info {
    flex: 1;
    padding: 10px;
    /* 解决文字超出显示范围，但是不显示省略号的问题 */
    min-width: 0;
  }
  .item-title {
    line-height: 27px;
    font-size: 16px;
    /* 文字溢出显示 ... */
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  .item-desc {
    line-height: 20px;
    color: #ccc;
    /* 文字溢出显示 ... */
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  .item-button {
    margin-top: 8px;
    background: #ff9300;
    padding: 0 .2rem;
    line-height: 22px;
    border-radius: 3px;
    color: #fff;
  }
</style>
